<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>運動員抵達桃園高鐵情形</title>
    </head>
    <body>
        <div class="body">
            <h1>運動員抵達桃園高鐵情形(目前有${arrivalCount}位運動員正在前往桃園高鐵站的路上)</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            
            <g:form method="post">
				<g:hiddenField name="byForm" value="true" />
				認證號碼：<g:textField name="uidKey" />
				姓名：<g:textField name="nameKey" /><br />
				國別：<g:select name="nationKey" from="${Nation.list()}" optionKey="name" optionValue="name" noSelection="['':'-Choose Nation-']"/>
				運動項目：<g:select name="sportKey" from="${Sport.list()}" optionKey="name" optionValue="name" noSelection="['':'-Choose Sport-']"/><br/>
				預計抵達時間：從<calendar:datePicker name="startComeAt"/> 00:00 到 <calendar:datePicker name="endComeAt"/> 23:59
				<g:actionSubmit action="nTrain" value="撈"/>
			</g:form>
			
			<hr /> 
             
             <table>
             <tr>
             	<td>認證號碼</td>
             	<td>姓名</td>
             	<td>國別</td>
            	<td>性別</td>
            	<td>運動項目</td>
            	<td>category</td>
            	<td>抵達機場</td>
            	<td>實際抵達桃園機場時間</td>
             	<td>預計抵達桃園高鐵站時間</td>
             	<td>實際抵達桃園高鐵站時間</td>
             	<td></td>
             </tr>
             <g:each var="person" in="${people}">
			 	<tr class="mouseOver">
			 		<td>${person.uid}</td>
			 		<td><g:link controller="sportsman" action="show" id="${person.id}">${person.name}</g:link></td>
			 		<td>${person.nation?.name}</td>
					<td>${person.sex}</td>
					<td>${person.sport?.name}</td>
					<td>${person.category}</td>
					<td>${person.comeAirport?.name}</td>
					<td><g:if test="${person.nAirportComeAt > new Date(0)}"><g:formatDate format="MM-dd HH:mm" date="${person.nAirportComeAt}" /></g:if></td>
			 		<td><g:if test="${person.predictNTrainComeAt > new Date(0)}"><g:formatDate format="MM-dd HH:mm" date="${person.predictNTrainComeAt}" /></g:if></td>
			 		<td><g:if test="${person.nTrainComeAt > new Date(0)}"><g:formatDate format="MM-dd HH:mm" date="${person.nTrainComeAt}" /></g:if></td>
			 		<td>
			 			<g:link action="nTrain" params="[actionType:'submit', personId:person.id,
			 												byForm:params.byForm, 
															 uidKey:params.uidKey, 
															 nameKey:params.nameKey, 
															 nationKey:params.nationKey, 
															 sportKey:params.sportKey, 
															 startComeAt:params.startComeAt, 
															 startComeAt_year:params.startComeAt_year,
															 startComeAt_month:params.startComeAt_month,
															 startComeAt_day:params.startComeAt_day,
															 endComeAt:params.endComeAt,
															 endComeAt_year:params.endComeAt_year,
															 endComeAt_month:params.endComeAt_month,
															 endComeAt_day:params.endComeAt_day]">確定抵達</g:link>
			 			<g:link action="nTrain" params="[actionType:'delete', personId:person.id,
			 												byForm:params.byForm, 
															 uidKey:params.uidKey, 
															 nameKey:params.nameKey, 
															 nationKey:params.nationKey, 
															 sportKey:params.sportKey, 
															 startComeAt:params.startComeAt, 
															 startComeAt_year:params.startComeAt_year,
															 startComeAt_month:params.startComeAt_month,
															 startComeAt_day:params.startComeAt_day,
															 endComeAt:params.endComeAt,
															 endComeAt_year:params.endComeAt_year,
															 endComeAt_month:params.endComeAt_month,
															 endComeAt_day:params.endComeAt_day]">移除紀錄</g:link>
			 		</td>
			 	</tr>
             </g:each>
             </table>

        </div>
    </body>
</html>
